package com.ftg.learn.controller;

import com.ftg.learn.service.ISkuService;
import com.ftg.learn.util.PageEx;
import com.ftg.learn.util.R;
import com.ftg.learn.vo.SKUListVo;
import io.swagger.annotations.ApiParam;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.math.BigDecimal;

/**
 * <p>
 * SKU 表 前端控制器
 * </p>
 *
 * @author 布衣
 * @since 2025-07-22
 */
@RestController
@RequestMapping("/sku")
public class SkuController {

    @Resource
    ISkuService skuService;

    @GetMapping("/list")
    public R<PageEx<SKUListVo>> list(
            @ApiParam(value = "商品名称") @RequestParam(value = "name", required = false) String name,
            @ApiParam(value = "商品价格区间") @RequestParam(value = "minPrice", required = false) BigDecimal minPrice,
            @ApiParam(value = "商品价格区间") @RequestParam(value = "maxPrice", required = false) BigDecimal maxPrice,
            @ApiParam(value = "页码") @RequestParam(value = "page") Integer page,
            @ApiParam(value = "显示条数") @RequestParam(value = "size") Integer size
    ){
        return skuService.list(name, minPrice, maxPrice, page, size);
    }

}
